package 集合相关.map;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

public class HashMapD {
	enum a {
		A, B, C
	};

	public static void main(String[] args) {

		// mapD();
		// SortD();

		// enumD();

		// String a = "asdASDSsad";
		// System.out.println(a.toUpperCase());
		// System.out.println(a.toLowerCase());
		// try {
		// exception(0);
		// } catch (Exception e) {
		// // TODO Auto-generated catch block
		// e.printStackTrace();
		// }
		System.out.println(books().size());

		// Random random=new Random();
		// int i=random.nextInt(10);
		// System.out.println(i);

//		calc();
		
		BigDecimal bigDecimal=new BigDecimal(10);
		Object obj=10.123;
		double i=(double) obj;
		System.out.println(i);
		// use StringBuilder replace String 
		StringBuilder sb=new StringBuilder();
		// use inteface replace Object 
		//接口优先 反射机制
		System.out.println(0.06 + 0.001);
		System.out.println(Math.PI);
		Object oo=1;
		Integer ii=(Integer) oo;
		int i2=(int) oo;

	}
	
/**
 * 错误的计算结果显示
 * 
 * 
 */

	private static void calc() {
		System.out.println(0.06 + 0.01);
		System.out.println(1.0 - 0.42);
		System.out.println(4.015 * 100);
		System.out.println(303.1 / 1000);
	}

	private static List books() {
		java.util.List ll = new ArrayList<>();
		return ll;

	}

	private static void exception(int i) throws Exception {
		if (i == 0)
			throw new Exception("0000");
		else
			throw new Exception("22");
	}

	private static void enumD() {
		switch (a.A) {
		case A:
			System.out.println("aa");
			System.out.println(a.A.getDeclaringClass());
			break;
		case B:
			System.out.println("bb");
			break;

		default:
			break;
		}
	}

	/**
	 * 排序
	 */
	private static void SortD() {
		ArrayList<Integer> list = new ArrayList<>();
		list.add(1);
		list.add(4);
		list.add(2);
		list.add(11);

		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));

		}
	}
/**
 * 
 */
	private static void mapD() {
		Map<String, String> map = new HashMap<>();
		map.put("d", "ding");
		map.put("q", "qing");
		map.put("b", "bo");
		// 迭代器
		Iterator<?> iterator = map.entrySet().iterator();
		while (iterator.hasNext()) {
			Map.Entry<?, ?> entry = (Entry<?, ?>) iterator.next();
			String key = (String) entry.getKey();
			String val = (String) entry.getValue();
			System.out.println(key + "," + val + "," + map.get(key));

		}
	}

}
